<template>
  <view class="mask" v-if="show">
    <view class="modal">
      <slot></slot>
      
      <view class="close-circle" @click="handleClose">
        <text class="close-icon">×</text>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: 'CustomPopup',
  
  props: {
    show: {
      type: Boolean,
      default: false
    }
  },
  
  methods: {
    handleClose() {
      this.$emit('close')
    }
  }
}
</script>

<style lang="less" scoped>
.mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  
  .modal {
    width: 650rpx;
    background: #fff;
    border-radius: 20rpx;
    padding: 40rpx 30rpx;
    position: relative;
  }

  .close-circle {
    position: absolute;
    left: 50%;
    bottom: -120rpx;
    transform: translateX(-50%);
    width: 67rpx;
    height: 67rpx;
    background: #fff;
    border-radius: 50%;
    color: #78797A;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .close-icon {
    font-size: 50rpx;
    line-height: 1;
  }
}
</style>
